using Castle.MonoRail.Framework;

namespace WineCellar.Web.Components
{

    public class MessageComponent : ViewComponent
    {
        public override void Initialize()
        {
            base.Initialize();
        }
        public override void Render()
        {
            MessageCollection messages =(MessageCollection) ComponentParams["messages"];
            if (messages != null)
            {
                PropertyBag["information"] = messages.GetMessagesInClass(Message.Enums.MessageClass.Information);
                PropertyBag["warning"] = messages.GetMessagesInClass(Message.Enums.MessageClass.Warning);
                PropertyBag["error"] = messages.GetMessagesInClass(Message.Enums.MessageClass.Error);
            }
            base.Render();
        }
    }
}
